package day16;

import java.util.LinkedList;

public class LinkedListPractice {
    public static void main(String[] args) {
        LinkedList<String> list=new LinkedList<>();
        list.add("三国演义");
        list.add("红楼梦");
        list.add("西游记");
        list.add("水浒传");
        System.out.println(list.peekFirst());
        System.out.println(list.getFirst());
        System.out.println(list.peek());
        list.addFirst("聊斋志异");
        list.addLast("盗墓笔记");
        System.out.println(list);
        System.out.println(list.getLast());
        System.out.println(list.get(list.size()-1));
        System.out.println(list.peekLast());
        System.out.println(list.offerFirst("鬼吹灯"));
        System.out.println(list.offerLast("金瓶梅"));
        System.out.println(list);
        LinkedList<String> list2=new LinkedList<>();
        list2.add("松江");
        list2.add("吴用");
        list2.add("武松");
        list2.add("鲁达");
        System.out.println(list2);
        System.out.println(list.addAll(3,list2));
        System.out.println(list);
    }
}
